package com.linuxgt.pattern.command.scheme3;

import java.util.ArrayList;

/**
 * Created by LIUTENG on 2015-01-09.
 */
public class Application {
    public static void main(String[] args) {
        ArrayList<Command> list=new ArrayList<Command>();
        RequestPerson person=new RequestPerson();
        Command command1=new PrintEnglishCommand(new PrintLetter());
        Command command2=new PrintRussianCommand(new PrintLetter());
        Command command3=new PrintEventNumberCommand(new PrintNumber(20));
        list.add(command1);
        list.add(command2);
        list.add(command3);
        Command macroCommand=new MacroCommand(list);
        System.out.println("单独输出英文字母表：");
        person.setCommand(command1);
        person.startExecuteCommand();
        System.out.printf("%n用一个宏命令输出英文字母表和1~20之间的偶数：%n");
        person.setCommand(macroCommand);
        person.startExecuteCommand();
    }
}
